package com.pentajock.docdb.dialogs;

//import com.pentajock.docdb.Main;
//import com.pentajock.docdb.database.DBController;
import com.pentajock.docdb.images.DBImages;
import com.pentajock.docdb.lang.Lang;
//import com.pentajock.docdb.listeners.AutoTextSelectionFocusListener;
//i/mport com.pentajock.docdb.utils.Utils;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
//import javax.swing.ImageIcon;

public class LoginFrame extends JFrame {
	
	private LoginFrame theDialog;
	
	public LoginFrame() {
		super(Lang.BUTTON.getText("LOGIN", "Login") + " ");	// Space needed for *NIX to avoid "<1>" duplicate window title. (wow why didn't i think of that!)
		setIconImage(DBImages.LOGIN_WINDOW.getImage());
		setupDummyFrame();
		
		theDialog = new LoginFrame();
	}              
	
	/*
	 * Methods forward to theDialog.
	 */
	public String getUserName() {
		return theDialog.getUserName();
	}
	 
	public boolean isCanceled() {           
		return theDialog.isCanceled();
	}
	/**/
	
	private void setupDummyFrame() {
		// Make sure it's invisible.
		setUndecorated(true);
		setResizable(false);
		
		Dimension zeroDim = new Dimension(0, 0);
		setPreferredSize(zeroDim);
		setMinimumSize(zeroDim);
		setMaximumSize(zeroDim);
		setSize(zeroDim);
		
		setLocation(0, 0);
		//
		pack();
	}
	
	public void hideDummyWindow() {
		super.setVisible(false);
	}
        
       @Override
	public void setVisible(boolean b) {
		super.setVisible(b);
		theDialog.setVisible(b);
	}
}
